{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:56:51.276439200Z",
     "start_time": "2023-12-14T06:56:49.937523Z"
    }
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.feature_extraction import DictVectorizer\n",
    "from sklearn.tree import DecisionTreeClassifier, export_graphviz"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "outputs": [],
   "source": [
    "data = pd.read_csv(\"D:\\\\data\\\\titanic\\\\train.csv\")"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:56:52.534605300Z",
     "start_time": "2023-12-14T06:56:52.444964100Z"
    }
   },
   "id": "89e2995bcc865cb1"
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "outputs": [
    {
     "data": {
      "text/plain": "     PassengerId  Survived  Pclass  \\\n0              1         0       3   \n1              2         1       1   \n2              3         1       3   \n3              4         1       1   \n4              5         0       3   \n..           ...       ...     ...   \n886          887         0       2   \n887          888         1       1   \n888          889         0       3   \n889          890         1       1   \n890          891         0       3   \n\n                                                  Name     Sex   Age  SibSp  \\\n0                              Braund, Mr. Owen Harris    male  22.0      1   \n1    Cumings, Mrs. John Bradley (Florence Briggs Th...  female  38.0      1   \n2                               Heikkinen, Miss. Laina  female  26.0      0   \n3         Futrelle, Mrs. Jacques Heath (Lily May Peel)  female  35.0      1   \n4                             Allen, Mr. William Henry    male  35.0      0   \n..                                                 ...     ...   ...    ...   \n886                              Montvila, Rev. Juozas    male  27.0      0   \n887                       Graham, Miss. Margaret Edith  female  19.0      0   \n888           Johnston, Miss. Catherine Helen \"Carrie\"  female   NaN      1   \n889                              Behr, Mr. Karl Howell    male  26.0      0   \n890                                Dooley, Mr. Patrick    male  32.0      0   \n\n     Parch            Ticket     Fare Cabin Embarked  \n0        0         A/5 21171   7.2500   NaN        S  \n1        0          PC 17599  71.2833   C85        C  \n2        0  STON/O2. 3101282   7.9250   NaN        S  \n3        0            113803  53.1000  C123        S  \n4        0            373450   8.0500   NaN        S  \n..     ...               ...      ...   ...      ...  \n886      0            211536  13.0000   NaN        S  \n887      0            112053  30.0000   B42        S  \n888      2        W./C. 6607  23.4500   NaN        S  \n889      0            111369  30.0000  C148        C  \n890      0            370376   7.7500   NaN        Q  \n\n[891 rows x 12 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>PassengerId</th>\n      <th>Survived</th>\n      <th>Pclass</th>\n      <th>Name</th>\n      <th>Sex</th>\n      <th>Age</th>\n      <th>SibSp</th>\n      <th>Parch</th>\n      <th>Ticket</th>\n      <th>Fare</th>\n      <th>Cabin</th>\n      <th>Embarked</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>1</td>\n      <td>0</td>\n      <td>3</td>\n      <td>Braund, Mr. Owen Harris</td>\n      <td>male</td>\n      <td>22.0</td>\n      <td>1</td>\n      <td>0</td>\n      <td>A/5 21171</td>\n      <td>7.2500</td>\n      <td>NaN</td>\n      <td>S</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>2</td>\n      <td>1</td>\n      <td>1</td>\n      <td>Cumings, Mrs. John Bradley (Florence Briggs Th...</td>\n      <td>female</td>\n      <td>38.0</td>\n      <td>1</td>\n      <td>0</td>\n      <td>PC 17599</td>\n      <td>71.2833</td>\n      <td>C85</td>\n      <td>C</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>3</td>\n      <td>1</td>\n      <td>3</td>\n      <td>Heikkinen, Miss. Laina</td>\n      <td>female</td>\n      <td>26.0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>STON/O2. 3101282</td>\n      <td>7.9250</td>\n      <td>NaN</td>\n      <td>S</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>4</td>\n      <td>1</td>\n      <td>1</td>\n      <td>Futrelle, Mrs. Jacques Heath (Lily May Peel)</td>\n      <td>female</td>\n      <td>35.0</td>\n      <td>1</td>\n      <td>0</td>\n      <td>113803</td>\n      <td>53.1000</td>\n      <td>C123</td>\n      <td>S</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>5</td>\n      <td>0</td>\n      <td>3</td>\n      <td>Allen, Mr. William Henry</td>\n      <td>male</td>\n      <td>35.0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>373450</td>\n      <td>8.0500</td>\n      <td>NaN</td>\n      <td>S</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>886</th>\n      <td>887</td>\n      <td>0</td>\n      <td>2</td>\n      <td>Montvila, Rev. Juozas</td>\n      <td>male</td>\n      <td>27.0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>211536</td>\n      <td>13.0000</td>\n      <td>NaN</td>\n      <td>S</td>\n    </tr>\n    <tr>\n      <th>887</th>\n      <td>888</td>\n      <td>1</td>\n      <td>1</td>\n      <td>Graham, Miss. Margaret Edith</td>\n      <td>female</td>\n      <td>19.0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>112053</td>\n      <td>30.0000</td>\n      <td>B42</td>\n      <td>S</td>\n    </tr>\n    <tr>\n      <th>888</th>\n      <td>889</td>\n      <td>0</td>\n      <td>3</td>\n      <td>Johnston, Miss. Catherine Helen \"Carrie\"</td>\n      <td>female</td>\n      <td>NaN</td>\n      <td>1</td>\n      <td>2</td>\n      <td>W./C. 6607</td>\n      <td>23.4500</td>\n      <td>NaN</td>\n      <td>S</td>\n    </tr>\n    <tr>\n      <th>889</th>\n      <td>890</td>\n      <td>1</td>\n      <td>1</td>\n      <td>Behr, Mr. Karl Howell</td>\n      <td>male</td>\n      <td>26.0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>111369</td>\n      <td>30.0000</td>\n      <td>C148</td>\n      <td>C</td>\n    </tr>\n    <tr>\n      <th>890</th>\n      <td>891</td>\n      <td>0</td>\n      <td>3</td>\n      <td>Dooley, Mr. Patrick</td>\n      <td>male</td>\n      <td>32.0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>370376</td>\n      <td>7.7500</td>\n      <td>NaN</td>\n      <td>Q</td>\n    </tr>\n  </tbody>\n</table>\n<p>891 rows × 12 columns</p>\n</div>"
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:56:53.285288800Z",
     "start_time": "2023-12-14T06:56:53.247227800Z"
    }
   },
   "id": "7f0995bf98af9a08"
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "outputs": [
    {
     "data": {
      "text/plain": "(891, 12)"
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.shape"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:56:53.999481100Z",
     "start_time": "2023-12-14T06:56:53.968492700Z"
    }
   },
   "id": "43776a1b08998783"
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "outputs": [
    {
     "data": {
      "text/plain": "       PassengerId    Survived      Pclass         Age       SibSp  \\\ncount   891.000000  891.000000  891.000000  714.000000  891.000000   \nmean    446.000000    0.383838    2.308642   29.699118    0.523008   \nstd     257.353842    0.486592    0.836071   14.526497    1.102743   \nmin       1.000000    0.000000    1.000000    0.420000    0.000000   \n25%     223.500000    0.000000    2.000000   20.125000    0.000000   \n50%     446.000000    0.000000    3.000000   28.000000    0.000000   \n75%     668.500000    1.000000    3.000000   38.000000    1.000000   \nmax     891.000000    1.000000    3.000000   80.000000    8.000000   \n\n            Parch        Fare  \ncount  891.000000  891.000000  \nmean     0.381594   32.204208  \nstd      0.806057   49.693429  \nmin      0.000000    0.000000  \n25%      0.000000    7.910400  \n50%      0.000000   14.454200  \n75%      0.000000   31.000000  \nmax      6.000000  512.329200  ",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>PassengerId</th>\n      <th>Survived</th>\n      <th>Pclass</th>\n      <th>Age</th>\n      <th>SibSp</th>\n      <th>Parch</th>\n      <th>Fare</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>count</th>\n      <td>891.000000</td>\n      <td>891.000000</td>\n      <td>891.000000</td>\n      <td>714.000000</td>\n      <td>891.000000</td>\n      <td>891.000000</td>\n      <td>891.000000</td>\n    </tr>\n    <tr>\n      <th>mean</th>\n      <td>446.000000</td>\n      <td>0.383838</td>\n      <td>2.308642</td>\n      <td>29.699118</td>\n      <td>0.523008</td>\n      <td>0.381594</td>\n      <td>32.204208</td>\n    </tr>\n    <tr>\n      <th>std</th>\n      <td>257.353842</td>\n      <td>0.486592</td>\n      <td>0.836071</td>\n      <td>14.526497</td>\n      <td>1.102743</td>\n      <td>0.806057</td>\n      <td>49.693429</td>\n    </tr>\n    <tr>\n      <th>min</th>\n      <td>1.000000</td>\n      <td>0.000000</td>\n      <td>1.000000</td>\n      <td>0.420000</td>\n      <td>0.000000</td>\n      <td>0.000000</td>\n      <td>0.000000</td>\n    </tr>\n    <tr>\n      <th>25%</th>\n      <td>223.500000</td>\n      <td>0.000000</td>\n      <td>2.000000</td>\n      <td>20.125000</td>\n      <td>0.000000</td>\n      <td>0.000000</td>\n      <td>7.910400</td>\n    </tr>\n    <tr>\n      <th>50%</th>\n      <td>446.000000</td>\n      <td>0.000000</td>\n      <td>3.000000</td>\n      <td>28.000000</td>\n      <td>0.000000</td>\n      <td>0.000000</td>\n      <td>14.454200</td>\n    </tr>\n    <tr>\n      <th>75%</th>\n      <td>668.500000</td>\n      <td>1.000000</td>\n      <td>3.000000</td>\n      <td>38.000000</td>\n      <td>1.000000</td>\n      <td>0.000000</td>\n      <td>31.000000</td>\n    </tr>\n    <tr>\n      <th>max</th>\n      <td>891.000000</td>\n      <td>1.000000</td>\n      <td>3.000000</td>\n      <td>80.000000</td>\n      <td>8.000000</td>\n      <td>6.000000</td>\n      <td>512.329200</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.describe()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:56:54.911452800Z",
     "start_time": "2023-12-14T06:56:54.847163300Z"
    }
   },
   "id": "8683c898c15edbfa"
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "outputs": [],
   "source": [
    "x = data[[\"Pclass\", \"Sex\", \"Age\"]]\n",
    "y = data[[\"Survived\"]]"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:56:56.149252700Z",
     "start_time": "2023-12-14T06:56:56.125283200Z"
    }
   },
   "id": "422609981e23c503"
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "outputs": [
    {
     "data": {
      "text/plain": "     Pclass     Sex   Age\n0         3    male  22.0\n1         1  female  38.0\n2         3  female  26.0\n3         1  female  35.0\n4         3    male  35.0\n..      ...     ...   ...\n886       2    male  27.0\n887       1  female  19.0\n888       3  female   NaN\n889       1    male  26.0\n890       3    male  32.0\n\n[891 rows x 3 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Pclass</th>\n      <th>Sex</th>\n      <th>Age</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>3</td>\n      <td>male</td>\n      <td>22.0</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>1</td>\n      <td>female</td>\n      <td>38.0</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>3</td>\n      <td>female</td>\n      <td>26.0</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>1</td>\n      <td>female</td>\n      <td>35.0</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>3</td>\n      <td>male</td>\n      <td>35.0</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>886</th>\n      <td>2</td>\n      <td>male</td>\n      <td>27.0</td>\n    </tr>\n    <tr>\n      <th>887</th>\n      <td>1</td>\n      <td>female</td>\n      <td>19.0</td>\n    </tr>\n    <tr>\n      <th>888</th>\n      <td>3</td>\n      <td>female</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>889</th>\n      <td>1</td>\n      <td>male</td>\n      <td>26.0</td>\n    </tr>\n    <tr>\n      <th>890</th>\n      <td>3</td>\n      <td>male</td>\n      <td>32.0</td>\n    </tr>\n  </tbody>\n</table>\n<p>891 rows × 3 columns</p>\n</div>"
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:56:57.362319200Z",
     "start_time": "2023-12-14T06:56:57.349268Z"
    }
   },
   "id": "ef470aff275bf1e2"
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "outputs": [
    {
     "data": {
      "text/plain": "     Survived\n0           0\n1           1\n2           1\n3           1\n4           0\n..        ...\n886         0\n887         1\n888         0\n889         1\n890         0\n\n[891 rows x 1 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Survived</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>886</th>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>887</th>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>888</th>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>889</th>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>890</th>\n      <td>0</td>\n    </tr>\n  </tbody>\n</table>\n<p>891 rows × 1 columns</p>\n</div>"
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:56:58.450749500Z",
     "start_time": "2023-12-14T06:56:58.427243600Z"
    }
   },
   "id": "27e18b8889296bc6"
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "outputs": [
    {
     "data": {
      "text/plain": "0      22.000000\n1      38.000000\n2      26.000000\n3      35.000000\n4      35.000000\n         ...    \n886    27.000000\n887    19.000000\n888    29.699118\n889    26.000000\n890    32.000000\nName: Age, Length: 891, dtype: float64"
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 对空的年龄用平均值填充\n",
    "x[\"Age\"].fillna(value=data[\"Age\"].mean(), inplace=False)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:56:59.565123500Z",
     "start_time": "2023-12-14T06:56:59.538397300Z"
    }
   },
   "id": "cd010c411c951758"
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "outputs": [
    {
     "data": {
      "text/plain": "     Pclass     Sex   Age\n0         3    male  22.0\n1         1  female  38.0\n2         3  female  26.0\n3         1  female  35.0\n4         3    male  35.0\n..      ...     ...   ...\n886       2    male  27.0\n887       1  female  19.0\n888       3  female   NaN\n889       1    male  26.0\n890       3    male  32.0\n\n[891 rows x 3 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Pclass</th>\n      <th>Sex</th>\n      <th>Age</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>3</td>\n      <td>male</td>\n      <td>22.0</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>1</td>\n      <td>female</td>\n      <td>38.0</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>3</td>\n      <td>female</td>\n      <td>26.0</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>1</td>\n      <td>female</td>\n      <td>35.0</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>3</td>\n      <td>male</td>\n      <td>35.0</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>886</th>\n      <td>2</td>\n      <td>male</td>\n      <td>27.0</td>\n    </tr>\n    <tr>\n      <th>887</th>\n      <td>1</td>\n      <td>female</td>\n      <td>19.0</td>\n    </tr>\n    <tr>\n      <th>888</th>\n      <td>3</td>\n      <td>female</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>889</th>\n      <td>1</td>\n      <td>male</td>\n      <td>26.0</td>\n    </tr>\n    <tr>\n      <th>890</th>\n      <td>3</td>\n      <td>male</td>\n      <td>32.0</td>\n    </tr>\n  </tbody>\n</table>\n<p>891 rows × 3 columns</p>\n</div>"
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:57:00.685634900Z",
     "start_time": "2023-12-14T06:57:00.664101300Z"
    }
   },
   "id": "72948bddc6d80fc5"
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "outputs": [],
   "source": [
    "trainX, testX, trainY, testY = train_test_split(x, y, random_state=22, test_size=0.2)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:57:01.776023100Z",
     "start_time": "2023-12-14T06:57:01.748446Z"
    }
   },
   "id": "ef78ad2617581e5e"
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "outputs": [],
   "source": [
    "# 特征工程必须转换成字典\n",
    "trainX = trainX.to_dict(orient=\"records\")\n",
    "testX = testX.to_dict(orient=\"records\")"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:57:02.813182700Z",
     "start_time": "2023-12-14T06:57:02.781452700Z"
    }
   },
   "id": "c5b5bc220514ed40"
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "outputs": [
    {
     "data": {
      "text/plain": "[{'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 30.5},\n {'Pclass': 2, 'Sex': 'female', 'Age': 3.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 35.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 32.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 2, 'Sex': 'male', 'Age': 32.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 17.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 39.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 23.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 31.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 26.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 34.5},\n {'Pclass': 3, 'Sex': 'female', 'Age': 40.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 2, 'Sex': 'female', 'Age': 24.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 2.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 33.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 31.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 17.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 43.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 56.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 38.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 25.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 29.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 2.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 28.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 41.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 51.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 40.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 56.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 50.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 23.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 28.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 44.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 28.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 45.5},\n {'Pclass': 1, 'Sex': 'male', 'Age': 38.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 18.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 30.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 32.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 45.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 4.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 31.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 22.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 27.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 43.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 37.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 18.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 14.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 10.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 27.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 41.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 20.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 0.75},\n {'Pclass': 2, 'Sex': 'male', 'Age': 66.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 31.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 34.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 39.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 40.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 39.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 48.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 39.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 18.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 25.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 33.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 25.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 21.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 20.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 21.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 43.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 42.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 16.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 23.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 40.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 16.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 24.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 31.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 21.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 44.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 30.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 19.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 40.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 51.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 22.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 24.5},\n {'Pclass': 1, 'Sex': 'male', 'Age': 65.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 3.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 27.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 54.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 45.5},\n {'Pclass': 1, 'Sex': 'female', 'Age': 32.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 29.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 42.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 45.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 44.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 2, 'Sex': 'female', 'Age': 42.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 35.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 28.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 24.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 28.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 34.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 40.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 21.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 36.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 45.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 6.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 18.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 34.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 58.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 23.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 28.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 42.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 40.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 14.5},\n {'Pclass': 3, 'Sex': 'male', 'Age': 44.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 35.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 1.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 48.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 17.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 36.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 30.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 32.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 44.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 26.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 30.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 15.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 37.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 28.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 35.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 62.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 22.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 1.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 24.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 16.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 20.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 9.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 30.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 18.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 34.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 27.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 17.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 20.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 18.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 11.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 44.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 14.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 36.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 21.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 23.5},\n {'Pclass': 1, 'Sex': 'male', 'Age': 37.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 12.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 28.5},\n {'Pclass': 2, 'Sex': 'male', 'Age': 16.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 19.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 39.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 8.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 35.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 19.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 19.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 25.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 2.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 25.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 24.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 43.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 48.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 18.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 45.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 26.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 30.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 32.5},\n {'Pclass': 1, 'Sex': 'male', 'Age': 0.92},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 2, 'Sex': 'male', 'Age': 18.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 48.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 38.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 35.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 54.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 20.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 30.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 31.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 2, 'Sex': 'female', 'Age': 31.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 31.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 9.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 70.5},\n {'Pclass': 3, 'Sex': 'female', 'Age': 20.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 42.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 26.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 39.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 71.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 3.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 53.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 30.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 28.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 28.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 27.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 35.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 74.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 2, 'Sex': 'female', 'Age': 34.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 47.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 32.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 50.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 21.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 22.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 2, 'Sex': 'male', 'Age': 25.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 0.42},\n {'Pclass': 1, 'Sex': 'male', 'Age': 24.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 27.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 70.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 21.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 50.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 35.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 58.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 38.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 52.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 41.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 19.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 16.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 58.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 34.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 4.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 16.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 11.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 16.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 29.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 55.5},\n {'Pclass': 3, 'Sex': 'female', 'Age': 24.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 50.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 21.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 36.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 18.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 22.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 18.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 25.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 36.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 5.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 30.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 39.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 35.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 19.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 30.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 2, 'Sex': 'male', 'Age': 1.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 19.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 24.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 62.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 23.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 16.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 5.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 32.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 64.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 22.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 42.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 64.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 60.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 48.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 20.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 23.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 18.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 28.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 46.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 39.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 28.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 28.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 26.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 29.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 36.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 19.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 32.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 29.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 47.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 29.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 36.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 30.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 25.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 27.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 28.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 31.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 38.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 32.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 19.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 39.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 3.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 16.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 19.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 51.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 13.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 19.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 14.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 16.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 33.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 22.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 42.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 22.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 27.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 22.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 5.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 40.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 65.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 51.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 54.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 1.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 49.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 30.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 17.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 28.5},\n {'Pclass': 3, 'Sex': 'male', 'Age': 17.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 30.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 58.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 2, 'Sex': 'male', 'Age': 34.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 37.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 8.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 2, 'Sex': 'female', 'Age': 48.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 17.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 9.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 21.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 22.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 34.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 35.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 22.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 2, 'Sex': 'female', 'Age': 55.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 32.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 33.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 36.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 42.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 29.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 20.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 56.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 17.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 20.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 9.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 16.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 24.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 30.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 63.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 45.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 47.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 39.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 38.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 7.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 0.67},\n {'Pclass': 3, 'Sex': 'male', 'Age': 18.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 65.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 9.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 28.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 31.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 27.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 50.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 60.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 21.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 44.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 19.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 49.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 23.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 25.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 17.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 17.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 48.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 26.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 56.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 2, 'Sex': 'male', 'Age': 35.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 42.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 33.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 38.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 19.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 14.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 34.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 60.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 8.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 19.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 40.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 28.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 29.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 0.83},\n {'Pclass': 2, 'Sex': 'male', 'Age': 34.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 22.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 35.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 21.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 40.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 26.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 24.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 16.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 13.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 45.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 27.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 2.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 5.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 30.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 2, 'Sex': 'female', 'Age': 40.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 31.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 60.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 2, 'Sex': 'male', 'Age': 36.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 36.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 30.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 45.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 20.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 24.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 33.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 22.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 2, 'Sex': 'male', 'Age': 21.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 26.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 32.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 25.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 0.83},\n {'Pclass': 2, 'Sex': 'female', 'Age': 2.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 24.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 31.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 61.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 35.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 50.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 19.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 27.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 42.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 1.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 61.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 26.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 3.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 22.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 26.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 24.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 4.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 41.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 47.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 18.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 62.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 25.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 20.5},\n {'Pclass': 3, 'Sex': 'male', 'Age': 9.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 39.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 22.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 28.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 54.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 26.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 17.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 21.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 55.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 22.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 40.5},\n {'Pclass': 2, 'Sex': 'male', 'Age': 27.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 30.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 70.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 4.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 35.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 45.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 19.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 80.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 45.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 59.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 54.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 29.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 18.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 42.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 14.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 2, 'Sex': 'female', 'Age': 34.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 29.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 19.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 18.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 19.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 34.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 44.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 32.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 25.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 15.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 2.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 25.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 52.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 24.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 32.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 21.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 18.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 19.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 22.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 24.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 18.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 39.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 28.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 26.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 30.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 25.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 57.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 49.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 6.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 2, 'Sex': 'male', 'Age': 24.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 4.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 15.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 27.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 33.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 48.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 22.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 31.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 36.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 4.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 1.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 28.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 25.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 17.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 16.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 26.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 32.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 28.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 11.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 22.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 4.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 31.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 24.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 28.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 21.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 4.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 23.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 47.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 24.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 0.75},\n {'Pclass': 3, 'Sex': 'male', 'Age': 22.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 25.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 16.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 36.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 24.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 71.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 2, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 22.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 21.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 36.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 52.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 19.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 2.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 18.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 23.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 29.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 27.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 40.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 27.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 36.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 22.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 41.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 28.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 24.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 61.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 51.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 36.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 26.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 49.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 46.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 22.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 18.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 35.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 19.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 7.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 2.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 45.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 8.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 24.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 29.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 34.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 9.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': nan},\n {'Pclass': 2, 'Sex': 'male', 'Age': 28.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 22.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 2, 'Sex': 'female', 'Age': 29.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 27.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 26.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 26.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 33.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 16.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 50.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 23.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 25.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 2.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 21.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 22.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 35.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 47.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 39.0}]"
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "trainX"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:57:04.194581600Z",
     "start_time": "2023-12-14T06:57:04.145551100Z"
    }
   },
   "id": "622aa9f87fcf06ff"
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "outputs": [
    {
     "data": {
      "text/plain": "[{'Pclass': 3, 'Sex': 'female', 'Age': 23.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 46.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 4.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 2, 'Sex': 'female', 'Age': 23.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 33.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 20.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 59.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 16.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 36.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 24.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 63.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 7.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 27.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 38.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 38.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 29.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 30.5},\n {'Pclass': 3, 'Sex': 'male', 'Age': 14.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 21.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 18.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 19.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 31.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 41.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 30.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 23.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 52.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 33.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 3.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 34.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 10.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 23.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 27.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 21.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 36.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 21.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 18.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 58.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 21.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 24.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 6.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 39.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 50.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 45.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 50.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 20.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 29.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 31.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 43.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 28.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 44.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 33.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 26.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 50.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 32.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 20.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 25.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 54.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 52.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 51.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 30.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 38.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 36.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 16.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 32.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 28.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 9.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 24.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 20.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 11.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 36.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 51.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 25.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 28.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 42.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 29.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 25.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 47.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 19.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 25.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 49.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 30.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 32.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 1.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 47.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 15.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 35.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 1, 'Sex': 'male', 'Age': 37.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 19.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 23.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 25.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 36.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 36.5},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 24.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 24.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 26.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 62.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 21.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 30.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 2.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': nan},\n {'Pclass': 2, 'Sex': 'male', 'Age': 30.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 2, 'Sex': 'female', 'Age': 36.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 33.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 30.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 33.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 32.5},\n {'Pclass': 3, 'Sex': 'female', 'Age': 37.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 21.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'male', 'Age': 42.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 38.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 25.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 24.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 36.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 54.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 40.5},\n {'Pclass': 1, 'Sex': 'female', 'Age': 33.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 18.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 29.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 18.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 34.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 19.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 18.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 52.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 15.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 45.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 22.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 32.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 33.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 22.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 24.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 18.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': nan},\n {'Pclass': 1, 'Sex': 'female', 'Age': 18.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 29.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 20.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 31.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 40.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 29.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 54.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 57.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 30.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': nan},\n {'Pclass': 3, 'Sex': 'female', 'Age': 24.0},\n {'Pclass': 3, 'Sex': 'male', 'Age': 21.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 29.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 47.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 35.0},\n {'Pclass': 1, 'Sex': 'female', 'Age': 24.0},\n {'Pclass': 2, 'Sex': 'female', 'Age': 17.0},\n {'Pclass': 3, 'Sex': 'female', 'Age': 4.0},\n {'Pclass': 1, 'Sex': 'male', 'Age': 49.0},\n {'Pclass': 2, 'Sex': 'male', 'Age': 48.0}]"
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "testX"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:57:05.355419700Z",
     "start_time": "2023-12-14T06:57:05.306293800Z"
    }
   },
   "id": "73c0288b94d17c03"
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "outputs": [],
   "source": [
    "transfer = DictVectorizer()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:57:06.767952800Z",
     "start_time": "2023-12-14T06:57:06.763955900Z"
    }
   },
   "id": "f200b20de74b9b10"
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "outputs": [],
   "source": [
    "trainX = transfer.fit_transform(trainX)\n",
    "testX = transfer.fit_transform(testX)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:57:08.040745300Z",
     "start_time": "2023-12-14T06:57:08.022285300Z"
    }
   },
   "id": "6727497fd3fb4317"
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "outputs": [
    {
     "data": {
      "text/plain": "<712x4 sparse matrix of type '<class 'numpy.float64'>'\n\twith 2136 stored elements in Compressed Sparse Row format>"
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "trainX"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:57:09.041604300Z",
     "start_time": "2023-12-14T06:57:09.009686900Z"
    }
   },
   "id": "425ead116c32c851"
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "outputs": [
    {
     "data": {
      "text/plain": "<179x4 sparse matrix of type '<class 'numpy.float64'>'\n\twith 537 stored elements in Compressed Sparse Row format>"
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "testX"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:57:10.008414700Z",
     "start_time": "2023-12-14T06:57:10.004405Z"
    }
   },
   "id": "3edec59c9e67bf75"
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "outputs": [],
   "source": [
    "# estimator = DecisionTreeClassifier(max_depth=5) # max_depth\n",
    "estimator = DecisionTreeClassifier()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:57:10.889073400Z",
     "start_time": "2023-12-14T06:57:10.884052300Z"
    }
   },
   "id": "a12befb5dc392053"
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "outputs": [
    {
     "ename": "ValueError",
     "evalue": "Input X contains NaN.\nDecisionTreeClassifier does not accept missing values encoded as NaN natively. For supervised learning, you might want to consider sklearn.ensemble.HistGradientBoostingClassifier and Regressor which accept missing values encoded as NaNs natively. Alternatively, it is possible to preprocess the data, for instance by using an imputer transformer in a pipeline or drop samples with missing values. See https://scikit-learn.org/stable/modules/impute.html You can find a list of all estimators that handle NaN values at the following page: https://scikit-learn.org/stable/modules/impute.html#estimators-that-handle-nan-values",
     "output_type": "error",
     "traceback": [
      "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
      "\u001B[1;31mValueError\u001B[0m                                Traceback (most recent call last)",
      "Cell \u001B[1;32mIn[20], line 1\u001B[0m\n\u001B[1;32m----> 1\u001B[0m \u001B[43mestimator\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mfit\u001B[49m\u001B[43m(\u001B[49m\u001B[43mtrainX\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mtrainY\u001B[49m\u001B[43m)\u001B[49m\n",
      "File \u001B[1;32m~\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\sklearn\\base.py:1152\u001B[0m, in \u001B[0;36m_fit_context.<locals>.decorator.<locals>.wrapper\u001B[1;34m(estimator, *args, **kwargs)\u001B[0m\n\u001B[0;32m   1145\u001B[0m     estimator\u001B[38;5;241m.\u001B[39m_validate_params()\n\u001B[0;32m   1147\u001B[0m \u001B[38;5;28;01mwith\u001B[39;00m config_context(\n\u001B[0;32m   1148\u001B[0m     skip_parameter_validation\u001B[38;5;241m=\u001B[39m(\n\u001B[0;32m   1149\u001B[0m         prefer_skip_nested_validation \u001B[38;5;129;01mor\u001B[39;00m global_skip_validation\n\u001B[0;32m   1150\u001B[0m     )\n\u001B[0;32m   1151\u001B[0m ):\n\u001B[1;32m-> 1152\u001B[0m     \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mfit_method\u001B[49m\u001B[43m(\u001B[49m\u001B[43mestimator\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[43margs\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[43mkwargs\u001B[49m\u001B[43m)\u001B[49m\n",
      "File \u001B[1;32m~\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\sklearn\\tree\\_classes.py:959\u001B[0m, in \u001B[0;36mDecisionTreeClassifier.fit\u001B[1;34m(self, X, y, sample_weight, check_input)\u001B[0m\n\u001B[0;32m    928\u001B[0m \u001B[38;5;129m@_fit_context\u001B[39m(prefer_skip_nested_validation\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mTrue\u001B[39;00m)\n\u001B[0;32m    929\u001B[0m \u001B[38;5;28;01mdef\u001B[39;00m \u001B[38;5;21mfit\u001B[39m(\u001B[38;5;28mself\u001B[39m, X, y, sample_weight\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mNone\u001B[39;00m, check_input\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mTrue\u001B[39;00m):\n\u001B[0;32m    930\u001B[0m \u001B[38;5;250m    \u001B[39m\u001B[38;5;124;03m\"\"\"Build a decision tree classifier from the training set (X, y).\u001B[39;00m\n\u001B[0;32m    931\u001B[0m \n\u001B[0;32m    932\u001B[0m \u001B[38;5;124;03m    Parameters\u001B[39;00m\n\u001B[1;32m   (...)\u001B[0m\n\u001B[0;32m    956\u001B[0m \u001B[38;5;124;03m        Fitted estimator.\u001B[39;00m\n\u001B[0;32m    957\u001B[0m \u001B[38;5;124;03m    \"\"\"\u001B[39;00m\n\u001B[1;32m--> 959\u001B[0m     \u001B[38;5;28;43msuper\u001B[39;49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_fit\u001B[49m\u001B[43m(\u001B[49m\n\u001B[0;32m    960\u001B[0m \u001B[43m        \u001B[49m\u001B[43mX\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    961\u001B[0m \u001B[43m        \u001B[49m\u001B[43my\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    962\u001B[0m \u001B[43m        \u001B[49m\u001B[43msample_weight\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43msample_weight\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    963\u001B[0m \u001B[43m        \u001B[49m\u001B[43mcheck_input\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mcheck_input\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    964\u001B[0m \u001B[43m    \u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m    965\u001B[0m     \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m\n",
      "File \u001B[1;32m~\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\sklearn\\tree\\_classes.py:247\u001B[0m, in \u001B[0;36mBaseDecisionTree._fit\u001B[1;34m(self, X, y, sample_weight, check_input, missing_values_in_feature_mask)\u001B[0m\n\u001B[0;32m    241\u001B[0m check_y_params \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mdict\u001B[39m(ensure_2d\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mFalse\u001B[39;00m, dtype\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mNone\u001B[39;00m)\n\u001B[0;32m    242\u001B[0m X, y \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_validate_data(\n\u001B[0;32m    243\u001B[0m     X, y, validate_separately\u001B[38;5;241m=\u001B[39m(check_X_params, check_y_params)\n\u001B[0;32m    244\u001B[0m )\n\u001B[0;32m    246\u001B[0m missing_values_in_feature_mask \u001B[38;5;241m=\u001B[39m (\n\u001B[1;32m--> 247\u001B[0m     \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_compute_missing_values_in_feature_mask\u001B[49m\u001B[43m(\u001B[49m\u001B[43mX\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m    248\u001B[0m )\n\u001B[0;32m    249\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m issparse(X):\n\u001B[0;32m    250\u001B[0m     X\u001B[38;5;241m.\u001B[39msort_indices()\n",
      "File \u001B[1;32m~\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\sklearn\\tree\\_classes.py:204\u001B[0m, in \u001B[0;36mBaseDecisionTree._compute_missing_values_in_feature_mask\u001B[1;34m(self, X)\u001B[0m\n\u001B[0;32m    201\u001B[0m common_kwargs \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mdict\u001B[39m(estimator_name\u001B[38;5;241m=\u001B[39m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m\u001B[38;5;18m__class__\u001B[39m\u001B[38;5;241m.\u001B[39m\u001B[38;5;18m__name__\u001B[39m, input_name\u001B[38;5;241m=\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mX\u001B[39m\u001B[38;5;124m\"\u001B[39m)\n\u001B[0;32m    203\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_support_missing_values(X):\n\u001B[1;32m--> 204\u001B[0m     \u001B[43massert_all_finite\u001B[49m\u001B[43m(\u001B[49m\u001B[43mX\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[43mcommon_kwargs\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m    205\u001B[0m     \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m\n\u001B[0;32m    207\u001B[0m \u001B[38;5;28;01mwith\u001B[39;00m np\u001B[38;5;241m.\u001B[39merrstate(over\u001B[38;5;241m=\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mignore\u001B[39m\u001B[38;5;124m\"\u001B[39m):\n",
      "File \u001B[1;32m~\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\sklearn\\utils\\validation.py:200\u001B[0m, in \u001B[0;36massert_all_finite\u001B[1;34m(X, allow_nan, estimator_name, input_name)\u001B[0m\n\u001B[0;32m    174\u001B[0m \u001B[38;5;28;01mdef\u001B[39;00m \u001B[38;5;21massert_all_finite\u001B[39m(\n\u001B[0;32m    175\u001B[0m     X,\n\u001B[0;32m    176\u001B[0m     \u001B[38;5;241m*\u001B[39m,\n\u001B[1;32m   (...)\u001B[0m\n\u001B[0;32m    179\u001B[0m     input_name\u001B[38;5;241m=\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m\"\u001B[39m,\n\u001B[0;32m    180\u001B[0m ):\n\u001B[0;32m    181\u001B[0m \u001B[38;5;250m    \u001B[39m\u001B[38;5;124;03m\"\"\"Throw a ValueError if X contains NaN or infinity.\u001B[39;00m\n\u001B[0;32m    182\u001B[0m \n\u001B[0;32m    183\u001B[0m \u001B[38;5;124;03m    Parameters\u001B[39;00m\n\u001B[1;32m   (...)\u001B[0m\n\u001B[0;32m    198\u001B[0m \u001B[38;5;124;03m        documentation.\u001B[39;00m\n\u001B[0;32m    199\u001B[0m \u001B[38;5;124;03m    \"\"\"\u001B[39;00m\n\u001B[1;32m--> 200\u001B[0m     \u001B[43m_assert_all_finite\u001B[49m\u001B[43m(\u001B[49m\n\u001B[0;32m    201\u001B[0m \u001B[43m        \u001B[49m\u001B[43mX\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mdata\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43;01mif\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43msp\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43missparse\u001B[49m\u001B[43m(\u001B[49m\u001B[43mX\u001B[49m\u001B[43m)\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43;01melse\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mX\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    202\u001B[0m \u001B[43m        \u001B[49m\u001B[43mallow_nan\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mallow_nan\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    203\u001B[0m \u001B[43m        \u001B[49m\u001B[43mestimator_name\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mestimator_name\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    204\u001B[0m \u001B[43m        \u001B[49m\u001B[43minput_name\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43minput_name\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    205\u001B[0m \u001B[43m    \u001B[49m\u001B[43m)\u001B[49m\n",
      "File \u001B[1;32m~\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\sklearn\\utils\\validation.py:122\u001B[0m, in \u001B[0;36m_assert_all_finite\u001B[1;34m(X, allow_nan, msg_dtype, estimator_name, input_name)\u001B[0m\n\u001B[0;32m    119\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m first_pass_isfinite:\n\u001B[0;32m    120\u001B[0m     \u001B[38;5;28;01mreturn\u001B[39;00m\n\u001B[1;32m--> 122\u001B[0m \u001B[43m_assert_all_finite_element_wise\u001B[49m\u001B[43m(\u001B[49m\n\u001B[0;32m    123\u001B[0m \u001B[43m    \u001B[49m\u001B[43mX\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    124\u001B[0m \u001B[43m    \u001B[49m\u001B[43mxp\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mxp\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    125\u001B[0m \u001B[43m    \u001B[49m\u001B[43mallow_nan\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mallow_nan\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    126\u001B[0m \u001B[43m    \u001B[49m\u001B[43mmsg_dtype\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mmsg_dtype\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    127\u001B[0m \u001B[43m    \u001B[49m\u001B[43mestimator_name\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mestimator_name\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    128\u001B[0m \u001B[43m    \u001B[49m\u001B[43minput_name\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43minput_name\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    129\u001B[0m \u001B[43m\u001B[49m\u001B[43m)\u001B[49m\n",
      "File \u001B[1;32m~\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\sklearn\\utils\\validation.py:171\u001B[0m, in \u001B[0;36m_assert_all_finite_element_wise\u001B[1;34m(X, xp, allow_nan, msg_dtype, estimator_name, input_name)\u001B[0m\n\u001B[0;32m    154\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m estimator_name \u001B[38;5;129;01mand\u001B[39;00m input_name \u001B[38;5;241m==\u001B[39m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mX\u001B[39m\u001B[38;5;124m\"\u001B[39m \u001B[38;5;129;01mand\u001B[39;00m has_nan_error:\n\u001B[0;32m    155\u001B[0m     \u001B[38;5;66;03m# Improve the error message on how to handle missing values in\u001B[39;00m\n\u001B[0;32m    156\u001B[0m     \u001B[38;5;66;03m# scikit-learn.\u001B[39;00m\n\u001B[0;32m    157\u001B[0m     msg_err \u001B[38;5;241m+\u001B[39m\u001B[38;5;241m=\u001B[39m (\n\u001B[0;32m    158\u001B[0m         \u001B[38;5;124mf\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;130;01m\\n\u001B[39;00m\u001B[38;5;132;01m{\u001B[39;00mestimator_name\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m does not accept missing values\u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[0;32m    159\u001B[0m         \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m encoded as NaN natively. For supervised learning, you might want\u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[1;32m   (...)\u001B[0m\n\u001B[0;32m    169\u001B[0m         \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m#estimators-that-handle-nan-values\u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[0;32m    170\u001B[0m     )\n\u001B[1;32m--> 171\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m \u001B[38;5;167;01mValueError\u001B[39;00m(msg_err)\n",
      "\u001B[1;31mValueError\u001B[0m: Input X contains NaN.\nDecisionTreeClassifier does not accept missing values encoded as NaN natively. For supervised learning, you might want to consider sklearn.ensemble.HistGradientBoostingClassifier and Regressor which accept missing values encoded as NaNs natively. Alternatively, it is possible to preprocess the data, for instance by using an imputer transformer in a pipeline or drop samples with missing values. See https://scikit-learn.org/stable/modules/impute.html You can find a list of all estimators that handle NaN values at the following page: https://scikit-learn.org/stable/modules/impute.html#estimators-that-handle-nan-values"
     ]
    }
   ],
   "source": [
    "estimator.fit(trainX, trainY)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-14T06:57:12.967750700Z",
     "start_time": "2023-12-14T06:57:12.060459400Z"
    }
   },
   "id": "9b74b8a7db60fc77"
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "outputs": [],
   "source": [
    "predict = estimator.predict(testX)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-07T15:01:23.206073300Z",
     "start_time": "2023-12-07T15:01:23.158851500Z"
    }
   },
   "id": "726804cf3c32ec2c"
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "outputs": [
    {
     "data": {
      "text/plain": "array([1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0,\n       1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,\n       1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0,\n       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0,\n       0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0,\n       0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0,\n       0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0,\n       0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1,\n       1, 1, 0], dtype=int64)"
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "predict"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-07T15:01:25.998780100Z",
     "start_time": "2023-12-07T15:01:25.937640200Z"
    }
   },
   "id": "fa492b2609d53f22"
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "outputs": [
    {
     "data": {
      "text/plain": "0.7821229050279329"
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "score = estimator.score(testX, testY)\n",
    "score"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-07T15:02:04.943921400Z",
     "start_time": "2023-12-07T15:02:04.891193800Z"
    }
   },
   "id": "eecb0915410f4f9e"
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "outputs": [],
   "source": [
    "# 生成可视化文件\n",
    "export_graphviz(estimator, \"D:\\\\data\\\\titanic\\\\titanic.dot\")"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-07T15:24:36.068243700Z",
     "start_time": "2023-12-07T15:24:36.018523100Z"
    }
   },
   "id": "919e2d50b8857070"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   },
   "id": "edf5136486fa30e6"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   },
   "id": "fbe1e5225886d8cc"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   },
   "id": "be890efff18df675"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
